const PositionDao = require("../dao/position-dao.js");
const PositionService = {
	add(req,res,next){
		const {company,position,salary,address} = req.body;
		let logo = "";
		if(req.file)
			logo = "/images/upload/"+req.file.filename;
		PositionDao.save({company,position,salary,address,logo})
			.then((data)=>{
				res.json({
					res_code:1,
					res_error:"",
					res_body:{
						status:1,
						data:data
					}
				});
			})
			.catch((err)=>{
				res.json({
					res_code:0,
					res_error:err,
					res_body:{}
				});
			});
	}
}
module.exports = PositionService;